Three Sorting Algorithms Using Priority Queues

نویسنده

  • Amr Elmasry
چکیده

We establish a lower bound of B(n) = ndlogne−2dlogne +1 on the number of comparisons performed by any algorithm that uses priority queues to sort n elements. Three sorting algorithms using priority queues are introduced. The first algorithm performs the same comparisons as the classical Mergesort algorithm, but in a different order. The second algorithm performs at most 2n logn+O(n) comparisons, with the advantage of being adaptive; meaning that it runs faster when the input sequence has some presortedness. In particular, we show that this algorithm sorts an already sorted sequence in linear time; a fact that is not obvious since there is no special checks to guarantee this behavior. The third algorithm is almost implicit; it can be implemented using the input array and less than n extra bits. The number of comparisons performed by this algorithm is at most B(n) + 2.5n. The three algorithms have the advantage of producing every element of the sorted output, after the first, in O(logn), and can be implemented to be practically efficient.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

2 Priority Queue

In the last lecture, we discussed algorithms for integer sorting. In this lecture we will discuss the relationship between integer sorting algorithms and priority queue data structures. It is obvious that fast priority queues imply fast sorting, since if a priority queue can do Insert and Deletemin in O(f(n)), then we can sort in O(nf(n)) by inserting all elements into the queue then calling De...

متن کامل

Two Constant-Factor-Optimal Realizations of Adaptive Heapsort

In this paper we introduce two efficient priority queues. For both, insert requires O(1) amortized time and extract-min O(lgn) worstcase time including at most lgn+O(1) element comparisons, where n is the number of elements stored. One priority queue is based on a weak heap (array-based) and the other on a weak queue (pointer-based). In both, the main idea is to temporarily store the inserted e...

متن کامل

An Experimental Study of Word-level Parallelism in Some Sorting Algorithms

A number of algorithms for fundamental problems such as sorting, searching, priority queues and shortest paths have been proposed recently for the unit-cost RAM with word size w. These algorithms ooer dramatic (asymptotic) speedups over classical approaches to these problems. We describe some preliminary steps we have taken towards a systematic evaluation of the practical performance of these a...

متن کامل

Equivalence between Priority Queues and Sorting in External Memory

A priority queue is a fundamental data structure that maintains a dynamic ordered set of keys and supports the followig basic operations: insertion of a key, deletion of a key, and finding the smallest key. The complexity of the priority queue is closely related to that of sorting: A priority queue can be used to implement a sorting algorithm trivially. Thorup [11] proved that the converse is a...

متن کامل

A Framework for Speeding Up Priority-Queue Operations

We introduce a framework for reducing the number of element comparisons performed in priority-queue operations. In particular, we give a priority queue which guarantees the worst-case cost of O(1) per minimum finding and insertion, and the worst-case cost of O(log n) with at most log n+O(1) element comparisons per minimum deletion and deletion, improving the bound of 2 logn+ O(1) on the number ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2003